---
id: open
title: Opening Tracetest
description:  Get started with creating tests by opening Tracetest! Tracetest allows you to quickly build integration and end-to-end tests, powered by your OpenTelemetry traces. Learn how to get started with creating tests once you open Tracetest.
keywords:
  - tracetest
  - trace-based testing
  - observability
  - distributed tracing
  - testing
image: https://res.cloudinary.com/djwdcmwdz/image/upload/v1698686403/docs/Blog_Thumbnail_14_rsvkmo.jpg
---

This page showcases opening [Tracetest](https://app.tracetest.io/) for the first time and creating tests.

## Creating Trace-based Tests

You can create tests in two ways:

- Visually, in the Web UI
- Programmatically, in YAML

## Creating Trace-based Tests Visually

This guide will show how to create end-to-end and integration tests in less than 5 minutes via the Web UI.

:::note
To view the in-depth guide on creating tests visually, [check out this docs page](/web-ui/creating-tests).
:::

### Create

On the top right, click the **Create** button and select **Create New Test** in the drop down.

![Create a new test](https://res.cloudinary.com/djwdcmwdz/image/upload/v1688475179/docs/screely-1688475174365_ckq3cn.png)

Select an **HTTP Request** as the **test trigger**. Clicking **Create & Run** will save and trigger the test.

![API test against POST endpoint](https://res.cloudinary.com/djwdcmwdz/image/upload/v1696253160/docs/screely-1696253153066_khjz8y.png)

### Trigger

You'll be redirected to the test page where you can see four tabs and depending on which one you select you'll get access to:

- Test trigger and results.
- The entire distributed trace and trace analysis.
- Test specification and assertions.
- How to automate the test.

:::note
To view the in-depth guide on test results, [check out this docs page](/web-ui/test-results).
:::

The **Trigger** tab shows how the test was triggered and what the API response was.

![test result](https://res.cloudinary.com/djwdcmwdz/image/upload/v1696253230/docs/screely-1696253224366_f62411.png)

### Trace

The **Trace** tab shows the entire distributed trace for debugging and a trace analysis score.

![distributed trace and trace analysis score](https://res.cloudinary.com/djwdcmwdz/image/upload/v1688476460/docs/screely-1688476455986_q24aa2.png)

### Test

The **Test** tab shows span attributes. Here you add test specs and assertions on attribute values. You also get a test snippets out-of-the-box for common test cases.

In the sample below, you see how to assert that all database spans return in less than `100ms`.

![test specs](https://res.cloudinary.com/djwdcmwdz/image/upload/v1688476657/docs/screely-1688476653521_omxe4r.png)

### Automate

The **Automate** tab shows how to automate the test run with the Tracetest CLI and other automation options.

![automate](https://res.cloudinary.com/djwdcmwdz/image/upload/v1696285049/docs/screely-1696285040458_vjt0qv.png)

From here you can download a YAML file test definition and run it with the CLI.

## Creating Trace-based Tests Programatically

The test definition will contain:

- The **Trigger** for the test in the `trigger` section.
- The **Test Specifications** in the`specs` section.

You can either download the YAML file test definition, or write one from scratch.

### Create

Using the sample from above, create the Trace-based Test programatically.

```yaml title="pokeshop-import.yaml"
type: Test
spec:
  id: T7-delWIR
  name: Pokemon Import
  trigger:
    type: http
    httpRequest:
      method: POST
      url: http://localhost:8081/pokemon/import
      body: "{\"id\":52}"
      headers:
      - key: Content-Type
        value: application/json
  specs:
  - selector: span[tracetest.span.type="database"]
    name: "All Database Spans: Processing time is less than 100ms"
    assertions:
    - attr:tracetest.span.duration  <  100ms
    - attr:db.system != ""
  - selector: span[tracetest.span.type="http"]
    name: "All HTTP Spans: Status code is 200"
    assertions:
    - attr:http.status_code = 200
```

### Trigger

Using the CLI, trigger a test run.

```bash title="Terminal"
tracetest run test -f pokemon-import.yaml --required-gates test-specs --output pretty
```

### Output

The test run will complete and show a result.

```text title="Output"
✔ Pokemon Import (https://app.tracetest.io/organizations/<org_id>/environments/<env_id>/test/T7-delWIR/run/7/test) - trace id: <trace_id>
	✔ All Database Spans: Processing time is less than 100ms
	✔ All HTTP Spans: Status code is 200
```

The provided link in the test output will open the test run in the Tracetest Web UI.
